<?php
/**
 * Author: jikeSen
 * Email: 569045356@qq.com
 * WeChat: coco44886660
 * Date: 2018/3/30
 * Time: 下午2:55
 */

namespace app\admin\controller\v1;

use think\Request;
use app\common\Utils\Oss as Os;
use app\api\controller\Fun;

/**
 * @title 后台-阿里云资质
 * @description 接口说明
 *
 * @header name:copyright require:1 default:v1 desc:版本号(全局)
 */
class Oss extends Auth
{
    /**
     * @title 阿里oss获取上传资质
     * @description
     * @author jikesens
     * @url /api/index/index
     * @method POST
     *
     * @header name:interface require:1 default:Oss desc:接口组(全局)
     * @header name:access_token type:string require:1 default: other: desc:身份验证参数,登陆时返回
     *
     * @param name:acc_id type:string require:1 default: other: desc:身份验证参数,登陆时返回
     * @param name:command type:string require:1 default: other:getOssPolicy desc:获取资质
     * @param name:dir type:string require:1 default: other:test/ desc:上传目录
     * @return data:[]
     */
    public function getOssPolicy()
    {

        $dir = $this->param['dir'];

        if (empty($dir)) {//添加判断dir 是否存在
            return Fun::error('999995', '目录不能为空');
        }

        return Fun::success(Os::createPolicy($dir));
    }
}